.386
.model flat, stdcall
option casemap :none

	include	\masm32\include\windows.inc
	include \masm32\include\kernel32.inc
	include \masm32\include\user32.inc
	include \masm32\include\gdi32.inc

	includelib \masm32\lib\kernel32.lib
	includelib \masm32\lib\user32.lib
	includelib \masm32\lib\gdi32.lib
	
	MainProc		proto :DWORD, :DWORD, :DWORD, :DWORD
	EnumChildProc	proto :DWORD,:DWORD

.data?
	hInstance		HINSTANCE ?
	CommandLine		LPSTR ?
	hide_effect		dd ?
	show_effect		dd ?
	
.const
	ID_DLG1			equ 1001
	
.code
start:
	invoke	GetModuleHandle, NULL
	mov	hInstance, eax
	invoke	GetCommandLine
	mov	CommandLine, eax
	invoke DialogBoxParam, hInstance, ID_DLG1, 0, addr MainProc, 0
	invoke	ExitProcess, eax
	
MainProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
	.if uMsg == WM_INITDIALOG
		mov hide_effect, 0
		mov show_effect, 0
	.elseif uMsg == WM_COMMAND
		.if wParam == 1006
			mov hide_effect, 0
			mov show_effect, 0
			invoke EnumChildWindows, hWnd, addr EnumChildProc, NULL
			.if hide_effect == 0
				mov hide_effect, AW_HIDE
			.endif
			.if show_effect == 0
				mov show_effect, AW_ACTIVATE
			.endif
			invoke AnimateWindow, hWnd, 1000, hide_effect
			invoke Sleep, 1000
			invoke AnimateWindow, hWnd, 1000, show_effect
		.endif
	.elseif uMsg == WM_CLOSE
		invoke EndDialog,hWnd,0
		ret
	.endif
	xor eax, eax	
	ret
MainProc endp

EnumChildProc proc uses edi hwndChild:HWND, param:DWORD
	invoke SendMessage, hwndChild, BM_GETCHECK, 0, 0
	.if eax == BST_CHECKED
		invoke GetWindowLong, hwndChild, GWL_ID
		.if eax == 1011
			or hide_effect, AW_HIDE
		.elseif eax == 1012
			mov hide_effect, AW_HIDE or AW_SLIDE
		.elseif eax == 1013
			mov hide_effect, AW_HIDE or AW_BLEND
			
		.elseif eax == 1031
			or show_effect, AW_ACTIVATE
		.elseif eax == 1032
			or show_effect, AW_ACTIVATE or AW_SLIDE
		.elseif eax == 1033
			or show_effect, AW_ACTIVATE or AW_BLEND
			
		.elseif eax == 1021
			or hide_effect, AW_HOR_POSITIVE
		.elseif eax == 1022
			or hide_effect, AW_HOR_NEGATIVE
		.elseif eax == 1023
			or hide_effect, AW_VER_POSITIVE
		.elseif eax == 1024
			or hide_effect, AW_VER_NEGATIVE
		.elseif eax == 1025
			or hide_effect, AW_CENTER
			
		.elseif eax == 1041
			or show_effect, AW_HOR_POSITIVE
		.elseif eax == 1042
			or show_effect, AW_HOR_NEGATIVE
		.elseif eax == 1043
			or show_effect, AW_VER_POSITIVE
		.elseif eax == 1044
			or show_effect, AW_VER_NEGATIVE
		.elseif eax == 1045
			or show_effect, AW_CENTER
		.endif
	.endif
 
	xor eax, eax
	inc eax
	ret
EnumChildProc endp

end start
